#include <iostream>
#include "Chord.h"


//funcao para a thread
void* listen(void* arg) {
	Chord* c;
	c = (Chord *) arg;
	printf("chamou a thread\n");
	c->listen();
	printf("terminou a thread\n");
}

//arquivo para realizar o teste
int main() {
	
	char ip[] = "127.0.0.1";

	Chord c1(30,3000,1);
	Chord c2(40,3001,2);
	//Chord c3(50,3002,3);
	//Chord c4(500,3003,4);
	//Chord c5(1000,3004,5);
	
	pthread_t tid1,tid2;
	
	pthread_create(&tid1,NULL,&listen,(void *)&c1);
	pthread_create(&tid2,NULL,&listen,(void *)&c2);
	//sleep(5);
	c1.createNetwork(ip,3000);
	c2.connectToNetwork(ip,3000);	
	
	//c.send(COP_FIND,buffer,sizeof(texto),ip);
}
